package com.lanyou.esb.datadictionary;

import java.rmi.NoSuchObjectException;

import org.apache.commons.lang3.StringUtils;

/**
 * 令牌状态<br>
 * 描述：<br>
 * 0:未生效;1:生效;2：已过期;
 * 
 * @author Davey.wu
 */
public enum TokenStatus {

	DISABLE("0", "未生效"), ENABLE("1", "生效"),EXPIRE("2","已过期");

	public static final String TypeCode = "20009";

	public final String ValueCode;
	public final String ValueName;

	private TokenStatus(String code, String valueName) {
		this.ValueCode = code;
		this.ValueName = valueName;
	}

	public static TokenStatus get(String valueCode)
			throws NoSuchObjectException {
		if (StringUtils.isEmpty(valueCode)) {
			throw new NullPointerException();
		}
		for (TokenStatus type : TokenStatus.values()) {
			if (type.ValueCode.equals(valueCode)) {
				return type;
			}
		}
		throw new NoSuchObjectException(valueCode);
	}
}
